/* entity */
import Field from '@model/entity/Field'
/* util */
import { randomString } from 'pub-bbx-utils'

import i18n from '@src/locales';
const $t = i18n.t.bind(i18n);

export function getGroupsFields(displayName: string, isNull: number, setting: object): Field[] {
  return (
    [
      {
        'id': randomString(),
        'tableName': 'catalog',
        'isSystem': 1,
        'fieldName': randomString(),
        'displayName': displayName || $t('common.form.type.quality_rule') as string,
        'formType': 'separator',
        'defaultValue': null,
        'isNull': 1,
        'isSearch': 0,
        'placeHolder': '',
        'orderId': 15,
        'isDelete': 0,
        'isGuideData': false,
        'isVisible': true,
        'isHidden': 0,
        'show': true,
      },
      {
        'id': randomString(),
        'tableName': 'catalog',
        'isSystem': 1,
        'fieldName': 'qualityStartTime',
        'displayName': $t('common.form.preview.qualityInfoField.label1') as string,
        'exportAlias': 'qualityStartDate',
        'formType': 'select',
        'defaultValue': null,
        'isNull': isNull,
        'isSearch': 0,
        'placeHolder': $t('common.form.preview.qualityInfoField.placeholder1') as string,
        'setting': setting || {},
        'orderId': 16,
        'isDelete': 0,
        'isGuideData': false,
        'isVisible': true,
        'isHidden': 0,
        'show': true,
      },
      {
        'id': randomString(),
        'tableName': 'catalog',
        'isSystem': 1,
        'fieldName': 'qualityTime',
        'exportAlias': 'qualityDuration,qualityUnit',
        'displayName': $t('common.form.preview.qualityInfoField.label3') as string,
        'placeHolder': $t('common.form.preview.qualityRuleField.tips1') as string,
        'formType': 'select',
        'defaultValue': null,
        'isNull': isNull,
        'isSearch': 0,
        'orderId': 17,
        'isDelete': 0,
        'isGuideData': false,
        'isVisible': true,
        'isHidden': 0,
        'show': true,
      }
    ]
  )
}
